﻿/**
 * get Cookie value after decoding
 */
function GetCookieVal(offset) {
  var endstr = document.cookie.indexOf(";", offset);
  if (endstr === -1) {
    endstr = document.cookie.length;
  }
  return unescape(document.cookie.substring(offset, endstr));
}

/**
 * set Cookie value
 */
function SetCookie(name, value) {
  var expdate = new Date(), argv = arguments, argc = arguments.length, // argc
    expires = (argc > 2) ? argv[2] : null,
  //expires
    path = (argc > 3) ? argv[3] : null,
  // path
    domain = (argc > 4) ? argv[4] : null,
  // domain
    secure = (argc > 5) ? argv[5] : false;
  // secure

  if (expires !== null) {
    expdate.setTime(expdate.getTime() + (expires * 1000 ));
  }
  document.cookie = name + "=" + escape(value) + //name
    ((expires === null) ? "" : ("; expires=" + expdate.toGMTString())) + // expire
    ((path === null) ? "" : ("; path=" + path)) + // path
    ((domain === null) ? "" : ("; domain=" + domain)) + //domain
    ((secure === true) ? "; secure" : "");
  // secure
}

/**
 *  delete Cookie
 */
function DelCookie(name) {
  var exp = new Date(), cval = this.GetCookie(name);
  exp.setTime(exp.getTime() - 1);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

/**
 * get Cookie original value
 */
function GetCookie(name) {
  var arg = name + "=", alen = arg.length, clen = document.cookie.length, i = 0, j = 0;
  while (i < clen) {
    j = i + alen;
    if (document.cookie.substring(i, j) === arg)
      return this.GetCookieVal(j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i === 0) {
      break;
    }
  }
}

/**
 *  test Cookies, if not online, logout
 */
function onlineorNo() {
  var uname = GetCookie('username'), lFrag = GetCookie('loginFlag');
  if (typeof (uname) === "undefined" || uname === "" || typeof (lFrag) === "undefined" || lFrag === "") {
    window.top.location = 'home.asp';
  }
}

/**
 *  IP v4 checker
 */
function isIP(str) {
  if (typeof (str) === "undefined") {
    return false;
  }
  str = $.trim(str);

  var reg = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
  if (!reg.test(str)) {
    return false;
  }

  if (RegExp.$1 < 0 || RegExp.$1 > 255) {
    return false;
  }
  if (RegExp.$2 < 0 || RegExp.$2 > 255) {
    return false;
  }
  if (RegExp.$3 < 0 || RegExp.$3 > 255) {
    return false;
  }
  if (RegExp.$4 < 0 || RegExp.$4 > 255) {
    return false;
  }

  return true;
}

/*
 * 备选ip校验
 */
function isBackupIP(str) {

  if (typeof (str) === "undefined") {
    return false;
  }
  str = $.trim(str);
  if (str === "") {
    return true;
  }
  var reg = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
  if (!reg.test(str)) {
    return false;
  }

  if (RegExp.$1 < 0 || RegExp.$1 > 255) {
    return false;
  }
  if (RegExp.$2 < 0 || RegExp.$2 > 255) {
    return false;
  }
  if (RegExp.$3 < 0 || RegExp.$3 > 255) {
    return false;
  }
  if (RegExp.$4 < 0 || RegExp.$4 > 255) {
    return false;
  }

  return true;
}
/**
 * return true if str is IP or null
 */
function isIPn(str) {

  if (typeof (str) === "undefined") {
    return false;
  }

  if (str.length === 0) {
    return true;
  } else {
    return isIP(str);
  }
}

/**
 *  MAC format checker
 */
function isMac(str) {
  if (typeof (str) === "undefined") {
    return false;
  }
  str = $.trim(str);

  var reg = /^([a-fA-F\d]{2}:){5}([a-fA-F\d]{2})$/;
  return reg.test(str);
}

/**
 *  digit checker
 */
function isInt(str) {
  if (typeof (str) === "undefined") {
    return false;
  }
  str = $.trim(str);

  var reg = /^\d+$/;
  return reg.test(str);
}

/**
 *  Hex checker
 */
function isHex(str) {
  if (typeof (str) === "undefined") {
    return false;
  }
  str = $.trim(str);
  var reg = /^[a-fA-F\d]+$/;
  return reg.test(str);
}

/**
 * Mask checker
 */
function isMask(str) {
  if (typeof (str) === "undefined") {
    return false;
  } else if (!isIP(str)) {
    return false;
  }
  str = $.trim(str);

  var exp = /^(254|252|248|240|224|192|128|0)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)$/
  return exp.test(str);
}

function isMaskn(str) {
  if (typeof (str) === "undefined") {
    return false;
  }

  if (str.length === 0) {
    return true;
  } else {
    return isMask(str);
  }
}

/**
 * 传入任意格式字符串，判断是否是可以转化成MAC格式(00:00:00:00:00:00),
 * 若可以，转换并返回MAC格式字符串，否则,返回""
 * 目前支持数值型MAC转换成String.
 */
function formatMAC(str) {
  if (typeof (str) === "undefined") {
    return "";
  }
  str = $.trim(str);

  if (isMac(str)) {
    return str;
  }

  if (isHex(str) && str.length == 12) {
    return str.slice(0, 2) + ":" + str.slice(2, 4) + ":" + str.slice(4, 6) + ":" + str.slice(6, 8) + ":" + str.slice(8, 10) + ":" + str.slice(10, 12);
  } else {
    return str;
  }
}

/*
 * 校验ip1、ip2是否在相同网段
 */
function isInTheSameNet(ip1, ip2, mask) {

  //兼容以一个数组将全部参数传入的调用方式
  if (ip1.length == 3) {
    ip2 = ip1[1];
    mask = ip1[2];
    ip1 = ip1[0];
  }

  if (isIP(ip1) && isIP(ip2) && isMask(mask)) {
    ip1 = ip1.split(".");
    ip2 = ip2.split(".");
    mask = mask.split(".");
    if (ip1.length !== ip2.length || ip1.length !== mask.length) {
      return false;
    }

    var i = 0, len = 0;
    for (i = 0, len = ip1.length; i < len; i += 1) {
      if ((window.parseInt(ip1[i]) & window.parseInt(mask[i])) !== (window.parseInt(ip2[i]) & window.parseInt(mask[i]))) {
        return false;
      }
    }
    return true;
  } else {
    return false;
  }
}

/**
 *  校验地址池有效性
 */
function isValidDHCPPool(DHCPIPPoolBegin, DHCPIPPoolEnd) {

  //兼容以一个数组将全部参数传入的调用方式
  if (DHCPIPPoolBegin.length === 2) {
    DHCPIPPoolEnd = DHCPIPPoolBegin[1];
    DHCPIPPoolBegin = DHCPIPPoolBegin[0];
  }

  var ipBase = "192.168.197.1", mask = "255.255.255.0", // LAN IP, Mask
    validIPB = "192.168.197.2", validIPE = "192.168.197.240";

  if ((-1 === compareIP(DHCPIPPoolBegin, DHCPIPPoolEnd, ipBase, mask)) && // begin < end
    (0 <= compareIP(DHCPIPPoolBegin, validIPB, ipBase, mask)) && //LANIP < begin
    (0 >= compareIP(DHCPIPPoolEnd, validIPE, ipBase, mask))) {//  end <= .240
    return true;
  } else {
    return false;
  }
}

/*
 * 比较同一网段上IP大小
 * IP1,ip2：要比较的IP
 * ipBase，mask用于确认所在网络的基准IP及mask
 * return: 1   ip1 > ip2
 *		   -1  ip1 < ip2
 *		   0   ip1 = ip2
 *
 *         Undetermined 不在同一网段
 */
function compareIP(ip1, ip2, ipBase, mask) {
  if (isInTheSameNet(ip1, ipBase, mask)) {
    if (isInTheSameNet(ip2, ipBase, mask)) {
      ip1 = ip1.split(".");
      ip2 = ip2.split(".");
      for (i in ip1) {
        ip1[i] = window.parseInt(ip1[i], 10);
      }
      for (i in ip2) {
        ip2[i] = window.parseInt(ip2[i], 10);
      }

      if (ip1[0] !== ip2[0]) {
        return (ip1[0] > ip2[0]) ? 1 : -1;
      } else if (ip1[1] !== ip2[1]) {
        return (ip1[1] > ip2[1]) ? 1 : -1;
      } else if (ip1[2] !== ip2[2]) {
        return (ip1[2] > ip2[2]) ? 1 : -1;
      } else if (ip1[3] !== ip2[3]) {
        return (ip1[3] > ip2[3]) ? 1 : -1;
      } else {
        return 0;
      }
    } else
      return "Undetermined";
  } else
    return "Undetermined";
}

/**
 * 校验一个符合如下格式的时间段：
 * 02:00-05:00
 * 前面时间值必须小于后面；中间用"-"相连
 */
function isValidTimePeroid(timeStr) {
  if (typeof (timeStr) === "undefined") {
    return false;
  }

  var times = timeStr.split("-");
  if (times.length !== 2) {
    return false;
  }

  var start = times[0], end = times[1];
  if (!isTime(start) || !isTime(end)) {
    return false;
  }

  start = start.split(":");
  end = end.split(":");
  start[0] = window.parseInt(start[0], 10);
  start[1] = window.parseInt(start[1], 10);
  end[0] = window.parseInt(end[0], 10);
  end[1] = window.parseInt(end[1], 10);

  if (start[0] < end[0]) {
    return true;
  } else if (start[0] === end[0]) {
    if (start[1] < end[1]) {
      return true;
    }
  }

  return false;
}

function isTime(str) {
  if (typeof (str) === "undefined") {
    return false;
  }
  str = $.trim(str);
  reg = /^(\d{2}):(\d{2})$/;
  if (!reg.test(str)) {
    return false;
  }
  if (RegExp.$1 == 24 && RegExp.$2 == 00) {
    return true;
  }
  if (RegExp.$1 < 0 || RegExp.$1 > 23)
    return false;
  if (RegExp.$2 < 0 || RegExp.$2 > 59)
    return false;

  return true;
}

/*
 *	TD 家庭级 oam侧DCCC动态信道特殊校验
 *
 *  minTrafficBitRate<midTrafficBitRate<maxTrafficBitRate
 */

function tdDcccCheck(vals) {
  if (vals.length != 3)
    return true;
  if (parseInt(vals[0], 10) < parseInt(vals[1], 10) && parseInt(vals[1], 10) < parseInt(vals[2], 10))
    return true;
  return false;
}

/**
 * 1588  WorkMode, PortpacketMode, PortportMode 有效组合校验
 * @param {Array} [WorkMode,PortpacketMode,PortportMode]
 */
function check1588Cfg(vals) {
  if (vals.length !== 3) {
    return false;
  }

  var workMode = parseInt(vals[0], 10), //
    packetMode = parseInt(vals[1], 10), //
    portMode = parseInt(vals[2], 10);

  //if (workMode == PTP_ACR && packetMode != PTP_PACKET_MODE_OVER_UDPV4)
  if (workMode === 0 && packetMode !== 1) {
    return false;
  }

  //if (workMode == PTP_1588 && packetMode == PTP_PACKET_MODE_OVER_ETHERNET &&
  //portMode != PTP_PORT_MODE_MULTICAST)
  if (workMode === 1 && packetMode === 0 && portMode !== 0) {
    return false;
  }

  return true;
}

/**
 * 1588  WorkMode, PortpacketMode, PortportMode 有效组合校验
 * @param {Array} [WorkMode,Port1packetMode,Port1portMode,Port2packetMode,Port2portMode]
 */
function checkWorkMode(vals) {
  if (vals.length !== 5) {
    return false;
  }

  var port1Vals = [vals[0], vals[1], vals[2]], //
    port2Vals = [vals[0], vals[3], vals[4]];

  return check1588Cfg(port1Vals) && check1588Cfg(port2Vals);
}

/**
 * 1588  LinkBackupEnable, WorkMode 有效组合校验
 * @param {Array} [LinkBackupEnable, WorkMode]
 */
function checkLinkBackup(vals) {
  vals[0] = parseInt(vals[0], 10);
  vals[1] = parseInt(vals[1], 10);
  vals[2] = parseInt(vals[2], 10);

  var jTarget = true, iTarget = true;
  jTarget = BackupSetting(vals[2], vals[0]);

  if (vals.length !== 2) {
    iTarget = false;
  }
  var reg = /^[1-2]\d*$/;
  if (!reg.test(vals[1])) {
    iTarget = false;
  } else {
    if (vals[0] === 1 && vals[1] !== 1) {
      iTarget = false;
    } else {
      iTarget = true;
    }
  }
  return iTarget && jTarget;
}
/*
 * HeartBeatPort、LinkBackupEnable
 * 启动链路备份的时候高可以备份心跳端口不能选择port1-port2
 */
function BackupSetting(port, enable) {
  if (enable == 1) {
    if (port == 2 || port == 3) {
      return false;
    } else {
      return true;
    }
  } else {
    return true;
  }
}

/**
 * 1588  Ipsec时间格式校验：数字+单位（h/m/s）
 * @param {time}
 */
function isFormatIpsecTime(val) {
  var time = $.trim(val);
  if (time === "0" || time === "") {
    return true;
  } else {
    if (time.length > 1) {
      num = time.slice(0, time.length - 1);
      unit = time.slice(time.length - 1);

      if (unit == "h" || unit == "m" || unit == "s") {
        if (num.match(/\D/) == null) {
          if ((num.indexOf(0) == 0 && num.length == 1) || num.indexOf(0) != 0) {
            return true;
          } else {
            return false;
          }
        } else {
          return false;
        }
      } else {
        return false;
      }

    } else {
      return false;
    }
  }
}

/**
 * 702004.4000802 CellSelection.MsTxPwrMaxCCH
 * 取值范围:900频段:5~39,1800频段:0~30;步长为2
 */
function matchWorkingFreqBand(vals) {
  if (vals.length !== 2) {
    return false;
  }
  var pattern = "";
  if (vals[0] === "0") {
    pattern = "[5,39:2]";
  } else if (vals[0] === "1") {
    pattern = "[0,30:2]";
  } else if (vals[0] === "2") {
    pattern = "[5,39:2]||[0,30:2]";
  } else {
    return true;
  }

  return ValidCheck.IsValid(pattern, vals[1]);
}

/**
 * 简单的等待动态进程，将传入的str以1000毫秒时间间隔递增append到node后，
 * 要求node有text属性
 * 利用setTimeInterval增长str
 * maxStrCopies, 可选   max copies of str to show
 * 若传入timeout != null, 定时timeout(毫秒)后自动结束, 无 return
 *      timeout == null ，return: setTimeInterval 的timer，请在调用者手动
 * window.clearInterval(timer)
 */
function waitProcess(node, str, timeout, maxStrCopies) {
  var index = 1, maxLength = 10, initedText = $(node).text(), timer_wait_process = -1;
  if (maxStrCopies) {
    maxLength = maxStrCopies;
  }

  timer_wait_process = setInterval(function () {
    var current = index % maxLength, temp = "", i = 0;
    for (i = 0; i < current; i += 1) {
      temp += str;
    }
    index += 1;
    $(node).text(initedText + temp);
  }, 1000);

  if (timeout) {
    setTimeout(function () {
      window.clearInterval(timer_wait_process);
    }, timeout);
  } else {
    return timer_wait_process;
  }
}

/**获取URL中带的params
 * @param {String} search,Location.search,为null时以top.window.location.search替代;
 * @param {String} PName：要取值的参数名
 * @return {String} param , 如果没有PName的参数，返回 null
 */
function getURLParam(search, PName) {
  if (search === null) {
    search = top.window.location.search;
  }
  search = search.substring(search.indexOf("?") + 1, search.length);
  var params = search.split("&"), array = [], result = null;
  for (i in params) {
    params[i] = params[i].split("=");
  }

  for (i in params) {
    if (params[i][0] === PName) {
      result = params[i][1] || "";
      break;
    }
  }

  return result;
}

/**
 * 异步log到后台
 * message:要log的信息；
 * delay：延迟时间,默认500ms
 */
function logger(message, delay) {

  if (typeof (delay) === "undefined") {
    delay = 500;
  }

  window.setTimeout(function () {
    $.ajax({
      url: "/C/logFunction.asp",
      async: true,
      type: "post",
      cache: false,
      timeout: 1000,
      data: {
        caseType: 2,
        msg: message
      },
      success: function (data) {
        //	alert("Log success.");
      }
    });
  }, delay);
}

/**
 * 检测是否是Apple IOS平台系统
 */
function isIOSPlatform() {
  var reg = /iphone|ipad|ipod|ios/i, agent = navigator.userAgent.toLowerCase();
  return reg.test(agent);
}

/**
 * 检测移动设备
 */
function isMobile() {
  var reg = /mobile/i, agent = navigator.userAgent.toLowerCase();
  return reg.test(agent);
}

//帮助模块  单实例使用此函数
function help($, tipsID, elementsSelector) {
  var $mainContainer = $("#mainContainer"), $tips = $("#" + tipsID), //
    $elements, hight, windowRightHight;

  if ($tips.children('label').length === 0) {
    $elements = $(elementsSelector);
    $tips.append(top.Help.get($elements));
  }

  hight = $mainContainer.height();
  windowRightHight = top.$("#contentMainFrame").height();
  if (windowRightHight > hight) {
    hight = windowRightHight * 0.8;
  }
  $tips.height(hight);

  if ($mainContainer.hasClass("mainContainerMin")) {
    $mainContainer.removeClass("mainContainerMin");
    $tips.hide();
  } else {
    $mainContainer.addClass("mainContainerMin");
    $tips.show();
  }
}

/**
 * 检测LTE 结构体(601011) TempPCIList、RoutinePCIList 范围0-503,任何情况下不存在交集
 * 算法时间复杂度 (n*n-1)  , n为tempPCIList与routinePCIList的区间集合总数
 */
function PCITest(args) {
  var tempPCIList = args[0];
  var routinePCIList = args[1];
  var gFlag = true;

  var minScope = 0;
  var maxScope = 503;

  var minBorder = "";
  var maxBorder = "";

  var tempPCIListLeftStack = [];
  var tempPCIListRightStack = [];
  var routinePCIListLeftStack = [];
  var routinePCIListRightStack = [];

  /* tempPCIList routinePCIList长度合法性校验*/

  /* tempPCIList 单独格式与范围合法性校验 */
  var tempPCIListStr = tempPCIList.toString();
  var PCIListArr = [];
  if (tempPCIListStr.length != 0) {
    if (tempPCIListStr.lastIndexOf(',') == tempPCIListStr.length) {
      if (window.console)
        console.log("tempPCIList:End width , wrong!");
      return false;
    }

    PCIListArr = tempPCIListStr.split(',');

    /* 格式合法性 */
    var tempPCIListReg = /^\d{1,}\.{2}\d{1,}$|^\d{1,}$/;
    for (var i = 0; i < PCIListArr.length; i++) {
      var flag = tempPCIListReg.test(PCIListArr[i]);
      if (!flag) {
        if (window.console)
          console.log("tempPCIList:" + PCIListArr[i] + " wrong!");
        return false;
      }

      /* 初始化范围数组  */
      var i_scope = PCIListArr[i].split('..');
      if (i_scope.length == 1) {

        tempPCIListLeftStack.push(parseInt(i_scope[0]));
        tempPCIListRightStack.push(parseInt(i_scope[0]));

      } else {

        if (parseInt(i_scope[0]) >= parseInt(i_scope[1])) {
          if (window.console)
            console.log("tempPCIList:[" + i_scope[0] + "," + i_scope[1] + "] wrong!");
          return false;
        }

        tempPCIListLeftStack.push(parseInt(i_scope[0]));
        tempPCIListRightStack.push(parseInt(i_scope[1]));

      }

    }
  }

  /* routinePCIList 单独格式与范围合法性校验 */
  var routinePCIListStr = routinePCIList.toString();
  var routinePCIListArr = [];
  if (routinePCIListStr.length != 0) {
    if (routinePCIListStr.lastIndexOf(',') == routinePCIListStr.length) {
      if (window.console)
        console.log("routinePCIList:End width , wrong!");
      return false;
    }

    routinePCIListArr = routinePCIListStr.split(',');

    /* 格式合法性 */
    var routinePCIListReg = /^\d{1,}\.{2}\d{1,}$|^\d{1,}$/;
    for (var i = 0; i < routinePCIListArr.length; i++) {
      var flag = routinePCIListReg.test(routinePCIListArr[i]);
      if (!flag) {
        if (window.console)
          console.log("routinePCIList:" + routinePCIListArr[i] + " wrong!");
        return false;
      }

      /* 初始化范围数组  */
      var i_scope = routinePCIListArr[i].split('..');
      if (i_scope.length == 1) {

        routinePCIListLeftStack.push(parseInt(i_scope[0]));
        routinePCIListRightStack.push(parseInt(i_scope[0]));

      } else {

        if (parseInt(i_scope[0]) >= parseInt(i_scope[1])) {
          if (window.console)
            console.log("tempPCIList:[" + i_scope[0] + "," + i_scope[1] + "] wrong!");
          return false;
        }

        routinePCIListLeftStack.push(parseInt(i_scope[0]));
        routinePCIListRightStack.push(parseInt(i_scope[1]));

      }
    }
  }

  /* tempPCIList与 routinePCIList 交集合法性校验 */
  var composeLeftStack = [];
  var composeRightStack = [];
  var resultLeftStack = [];
  var resultRightStack = [];

  composeLeftStack = composeLeftStack.concat(tempPCIListLeftStack, routinePCIListLeftStack);
  composeRightStack = composeRightStack.concat(tempPCIListRightStack, routinePCIListRightStack);

  if (composeLeftStack.length >= 1) {
    minBorder = composeLeftStack[0];
    maxBorder = composeRightStack[0];
    for (var i = 0; i < composeLeftStack.length; i++) {
      minBorder = minBorder <= composeLeftStack[i] ? minBorder : composeLeftStack[i];
      maxBorder = maxBorder >= composeRightStack[i] ? maxBorder : composeRightStack[i];
    }

    if (minBorder < minScope || maxBorder > maxScope) {
      if (window.console)
        console.log("[" + minBorder + "," + maxBorder + "] not in [" + minScope + "," + maxScope + "]");
      return false;
    }
  }

  if (composeLeftStack.length >= 1) {
    resultLeftStack.push(composeLeftStack.pop());
    resultRightStack.push(composeRightStack.pop());
  }

  var l, r;
  for (var i = 0; i < composeLeftStack.length; i++) {
    l = composeLeftStack[i];
    r = composeRightStack[i];
    for (var j = 0; j < resultLeftStack.length; j++) {
      if (r < resultLeftStack[j] || l > resultRightStack[j]) {
        continue;
      } else {
        if (window.console)
          console.log("[" + l + "," + r + "] in [" + resultLeftStack[j] + "," + resultRightStack[j] + "] wrong!");
        return false;
      }
    }

    resultLeftStack.push(l);
    resultRightStack.push(r);
  }

  if (window.console) {
    console.log("tempPCIList:" + tempPCIList);
    console.log("routinePCIList:" + routinePCIList);
    console.log("OK");
  }

  return true;
}

/*
 *	GSM企业级3代 ,其他GSM企业级产品可能也用到
 *
 * son 中
 *  NonCandidateSecondaryARFCNListAllowed 为允许的情况下  CandidateSecondaryARFCNList 不允许为空
 *  CandidateSecondaryARFCNList 取值范围 512~636 个数为3
 */

function GSMCandidateSecondaryARFCNListCheck(vals) {

  var allowed = parseInt(vals[0], 10);

  //关联
  if (allowed == 0 && vals[1].length == 0) {
    return false;
  }

  //字符串长度
  //if(vals[1].length >4096) return false;

  var ARFCNList = vals[1].split(',');

  //个数
  //if( (ARFCNList.length >= 3 && ARFCNList.length <= 20 ) && allowed==0 ) return false;
  if (vals[1].length > 0 && (ARFCNList.length < 3 || ARFCNList.length > 20))
    return false;
  if (allowed == 1 && ARFCNList.length == 0)
    return true;

  //唯一性
  var c_point = parseInt(ARFCNList[0], 10);
  var stack = [];
  for (var i = 0; i < ARFCNList.length; i++) {
    c_point = parseInt(ARFCNList[i], 10);

    if (stack.length == 0) {
      stack.push(c_point);
    } else {
      for (var j = 0; j < stack.length; j++) {
        if (c_point == stack[j]) {
          return false;
        }
      }
      stack.push(c_point);
    }
  }

  //取值范围
  for (var i = 0; i < ARFCNList.length; i++) {
    var point = parseInt(ARFCNList[i], 10);

    if (point < 512 || point > 636)
      return false;
  }

  return true;
}

/**
 * 校验参数是否为数组数组
 * @Author   Yhk
 * @datetime 2016-11-14
 * @param    {[string]}   arguments ["28400,56211,21231"]
 * @return   {[bool]}    
 */
function checkIsNum(arguments) 
{
  var checkNum = /^[0-9]*[0-9]*$/;
  var listArr = arguments.split(",");
  var tempArr = [];
  for(var i=0; i<listArr.length; i++) {
    if(!checkNum.test(listArr[i])) return false;
  }

  return true;
}

/**
 * 对TAC自增周期进行校验
 * @Author   yhk
 * @datetime 2016-11-15
 * @param    {[string]}   args [[0,65535]]
 * @return   {[false]}    
 */
function rangeCheckTAC(args) 
{
  var lenArg = args.length;
  if('[' != args.charAt(0) || ']' != args.charAt(lenArg-1)) {
    return false;
  }
  var tempArr = args.substring(1, lenArg-1).split(",");
  if(!checkIsNum(tempArr[0]) || !checkIsNum(tempArr[1])) {
    return false;
  } else if(parseInt(tempArr[0]) >= parseInt(tempArr[1])) {
    return false;
  }
  return true;
}

function checkStringIsNum(arguments)
{
  var checkNum = /^[0-9]*[0-9]*$/;
  if(!checkNum.test(arguments)) return false;
  else return true;
}

/**
 * 校验候选频点是否为数字
 * @Author   yhk
 * @datetime 2016-11-15
 * @param    {[string]}   args [189000..191000,258000..262000]
 * @return   {[boolen]}  
 */
function testIsNum(args)
{
  var tempArr = args.split(",");
  for (var i = tempArr.length - 1; i >= 0; i--) {
    var tempArr2 = tempArr[i].split("..");
    for (var j = tempArr2.length - 1; j >= 0; j--) {
      if(!checkIsNum(tempArr2[j])) {
        return false;
      } 
    }
  }
  return true;
}